// -----------------------------------------------------------------------
//  <copyright file="LoginLogController.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2025 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025/1/15 10:35</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Identity.Application.Identity.LoginLogs.Commands;
using DaprPlus.Identity.Application.Identity.LoginLogs.Queries;


namespace DaprPlus.Identity.Api.Controllers;

[ApiResultWrapperFilter]
public class LoginLogController(IMediator mediator) : ApiControllerBase
{
    [HttpPost("read")]
    [Produces<PageResult<LoginLogOutDto>>]
    public async Task<ActionResult> Read([FromBody] GetLoginLogPageQuery query)
    {
        var page = await mediator.Send(query);
        return Ok(page);
    }

    [HttpDelete]
    [Produces<ApiResult>]
    public async Task<ActionResult> Delete(long[] ids)
    {
        var command = new DeleteLoginLogCommand(ids);
        var result = await mediator.Send(command);
        return Ok(result);
    }
}
